home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / Pascal Demo Projects / THINK Pascal 4.0 Demos / vDemoLP.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-26  |  4KB  |  134 lines

  1. {ViewIt 2.2 Demonstration Program}
  2. {©FaceWare 1991-93.  All Rights Reserved.}
  3.  
  4. program vDemoLP;
  5. {$I-}
  6.  
  7.     uses
  8.         FaceStorLP, FaceProcLP;
  9.  
  10.     var
  11.         helpShown: boolean;
  12.         myRec: record
  13.                 myInteger: integer;
  14.                 myReal: real;
  15.                 myString: string[99];
  16.                 myFlags: longint;
  17.             end;
  18.         myList: integer;
  19.         oldTicks, newTicks: longint;
  20.         theReal, delta: real;
  21.  
  22.     procedure JumpIt (thePtr: Ptr);
  23.     inline
  24.         $2257, $2051, $4E90;
  25.  
  26.     procedure OverProc (thePtr: Ptr);
  27.     begin
  28.         with fRec do
  29.             if (uCommand = 264) then    {a key down message?}
  30.                 if (uParam[1] = 32) then    {SPACE key pressed?}
  31.                     uParam[1] := 95;            {convert to UNDERLINE}
  32.         JumpIt(thePtr);                    {pass message to driver}
  33.     end;
  34.  
  35. begin
  36.     myRec.myInteger := 0;
  37.     myRec.myReal := 6.2;
  38.     myRec.myString := 'Hello';
  39.     myRec.myFlags := 10;
  40.     myList := 2;
  41.     oldTicks := 0;
  42.     theReal := 6.0;
  43.  
  44. {Initialize FaceIt}
  45.     fRec.uName := 'vDemo.Rsrc';
  46.     FaceIt(nil, DoInit, 0, 0, 0, 0);
  47.  
  48. {Open Modeless Window using FWND 1000}
  49.     FaceIt(nil, NewWnd, 1000, 1, 0, 0);
  50.  
  51.     with fRec do
  52.         repeat
  53.             FaceIt(nil, DoLoop, 0, 0, 0, 0);
  54. {Standard "About" Menu Item Selection}
  55.             if (uMenuID = 101) and (uMenuItem = 1) then
  56.                 begin
  57.                     uString := concat('Demonstration of the use of ViewIt', chr(13), 'windows in a FaceIt-based program.');
  58.                     FaceIt(nil, ShoStr, 3, 12, 1 + (409 * 65536), 0);
  59.                 end
  60. {Hit in Modeless Window's "Open Modal" Button}
  61.             else if (uMenuID = 1000) and (wcHit = 2) then
  62.                 begin
  63.                     FaceIt(nil, NewWnd, 1001, 0, 0, 0);        {Open Modal Window}
  64.                     repeat
  65.                         FaceIt(nil, MdlWnd, 1001, 0, 0, 0);        {Process Modal Events}
  66.                         if (wcHit = -1) then                            {Hit in Close Box}
  67.                             leave
  68.                         else if (wcHit = 1) then                    {Hit in "Open Nested" Button}
  69.                             begin                                                {Open Nested Modal}
  70.                                 FaceIt(nil, NewWnd, 1002, 0, 110, ord(@myRec));
  71.                                 FaceIt(nil, GetCtl, 1002, 0, 3, 3);            {Link Scrollable List}
  72.                                 FaceIt(nil, LnkCtl, ord(cControl), ord(@myList), 2, 0);
  73.                                 FaceIt(nil, GetCtl, 1002, 0, 2, 3);            {Set Override Proc}
  74.                                 FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
  75.                                 FaceIt(nil, SetVal, 1002, 0, 0, 0);            {Set Linked Values}
  76.                                 helpShown := false;
  77.                                 repeat
  78.                                     FaceIt(nil, MdlWnd, 1002, -2, 0, 0);        {Process Modal Events}
  79.                                     if (uMenuID = 0) then                        {No Message}
  80.                                         begin
  81.                                             newTicks := TickCount;
  82.                                             if (newTicks > oldTicks + 60) then
  83.                                                 begin
  84.                                                     oldTicks := newTicks;
  85.                                                     FaceIt(nil, GetCtl, 1002, 0, 2, 8);
  86.                                                     SetCtlValue(cControl, (cValue mod 4) + 1);
  87.                                                 end;
  88.                                         end
  89.                                     else if (wvHit = 1) then                    {Hit in View #1}
  90.                                         begin
  91.                                             if (wcHit = 1) then                        {Hit in "OK" Button}
  92.                                                 leave
  93.                                             else if (wcHit = 2) then                {Hit in "Show/Hide" Button}
  94.                                                 if helpShown then
  95.                                                     begin
  96.                                                         FaceIt(nil, ShoCtl, 0, 0, -3, 2);        {Hide v3, Show v2}
  97.                                                         helpShown := false;
  98.                                                     end
  99.                                                 else
  100.                                                     begin
  101.                                                         FaceIt(nil, ShoCtl, 0, 0, -2, 3);        {Hide v2, Show v3}
  102.                                                         helpShown := true;
  103.                                                     end;
  104.                                         end
  105.                                     else if (wvHit = 2) then                    {Hit in View #2}
  106.                                         if (wcHit = 6) or (wcHit = 7) then        {Hit in Up/Down Arrow}
  107.                                             begin
  108.                                                 FaceIt(nil, GetCtl, 1002, 0, 2, wcHit);
  109.                                                 delta := 0.001 * (cMin - 2);
  110.                                                 myRec.myReal := myRec.myReal + delta;
  111.                                                 FaceIt(nil, SetVal, 1002, 0, 2, 2);
  112.                                                 Delay(5, uI4);
  113.                                             end;
  114.                                 until false;
  115.                                 FaceIt(nil, GetVal, 1002, 0, 0, 0);            {Get Linked Values}
  116.                                 FaceIt(nil, EndWnd, 1002, 0, 0, 0);        {Close Nested Modal}
  117.                             end;
  118.                     until false;
  119.                     FaceIt(nil, EndWnd, 1001, 0, 0, 0);            {Close Modal Window}
  120.                 end
  121. {Hit in Modeless Window's "Why ViewIt?" Button}
  122.             else if (uMenuID = 1000) and (wcHit = 3) then
  123.                 begin
  124.                     FaceIt(nil, NewWnd, 1003, 0, 0, ord(@theReal));
  125.                     FaceIt(nil, SetVal, 1003, 0, 0, 0);
  126.                     repeat
  127.                         FaceIt(nil, MdlWnd, 1003, 0, 0, 0);
  128.                     until (wcHit = 1);
  129.                     FaceIt(nil, GetVal, 1003, 0, 0, 0);
  130.                     FaceIt(nil, EndWnd, 1003, 0, 0, 0);
  131.                 end;
  132.         until false;
  133.  
  134. end.